home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 9635 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  856 b 

  1. Path: news.production.compuserve.com!news
  2. From: Tom Wright <70215.1323@CompuServe.COM>
  3. Newsgroups: comp.lang.c
  4. Subject: Processing \n while reading char
  5. Date: 12 Mar 1996 13:58:44 GMT
  6. Organization: no organization
  7. Message-ID: <4i3vuk$ak$1@mhafc.production.compuserve.com>
  8.  
  9. I've got a small program that reads a person's initials, followed
  10. by reading his/her test score.  I used
  11.  
  12. for (blah, blah)
  13.   {
  14.   printf (blah)
  15.   scanf ("%c%c%c%*c", &c_1st, &c_mid, &c_last);
  16.   printf (blah)
  17.   scanf("%d%*c", &i_test_score):
  18.   }
  19.  
  20. I find the %*c to process the newline character to be somewhat
  21. clumsy.  Is there a cleaner way to process/eliminate the 
  22. newline character.
  23.  
  24. One constriant of the program is that it must read the initials
  25. as character data; for this exercise, I cannot use strings.
  26.  
  27. Any insight would be appreciated.
  28.  
  29. Tom
  30.  
  31. -- 
  32. Happy to be a soccer fan!!!
  33.